; Music of 5th Quadrant, The (1987) (Bubble Bus Software)
; Ripped by Megachur the 03/04/2007

	write "5THQUADR.BIN"

music_date_rip	equ &0347
music_adr	equ &a930
first_theme	equ 0
last_theme	equ 0	; 0 -> 0

	read "music_header_v1_0.asm"

.la930
	jp lab95	; init main theme
	jp lac53	; play
	jp laa9b
	jp la96f
	jp la974
	jp la979
	jp la98b
	jp la990
	jp la995
	jp la99a
	jp la99f
	jp la9a4
	jp la9a9
	jp la9ae
	jp la9b3
	jp la9b8
	jp la9bd
	jp la9c2
	jp la9c7
	jp la9cc
	jp la9d1
.la96f
	ld hl,la9de
	jr la9d6
.la974
	ld hl,la9e7
	jr la9d6
.la979
	ld hl,la9f0
	ld a,(#0080)
	dec a
	ld c,a
	add a
	add a
	add a
	add c
	ld c,a
	ld b,#00
	add hl,bc
	jr la9d6
.la98b
	ld hl,laa14
	jr la9d6
.la990
	ld hl,laa1d
	jr la9d6
.la995
	ld hl,laa26
	jr la9d6
.la99a
	ld hl,laa2f
	jr la9d6
.la99f
	ld hl,laa38
	jr la9d6
.la9a4
	ld hl,laa41
	jr la9d6
.la9a9
	ld hl,laa4a
	jr la9d6
.la9ae
	ld hl,laa53
	jr la9d6
.la9b3
	ld hl,laa5c
	jr la9d6
.la9b8
	ld hl,laa65
	jr la9d6
.la9bd
	ld hl,laa6e
	jr la9d6
.la9c2
	ld hl,laa77
	jr la9d6
.la9c7
	ld hl,laa80
	jr la9d6
.la9cc
	ld hl,laa89
	jr la9d6
.la9d1
	ld hl,laa92
	jr la9d6
.la9d6
	push ix
	call #bcaa
	pop ix
	ret
.la9de
	db #81,#01,#01,#c8,#00,#00,#00,#00
.la9e7 equ $ + 1
	db #00,#81,#02,#00,#00,#00,#1f,#00
.la9f0 equ $ + 2
	db #00,#00,#02,#03,#02,#1e,#00,#00
	db #00,#00,#00,#02,#03,#02,#01,#00
	db #00,#00,#00,#00,#02,#00,#00,#de
	db #03,#00,#0c,#03,#00,#02,#00,#03
.laa14 equ $ + 6
	db #90,#01,#00,#0c,#05,#00,#84,#00
.laa1d equ $ + 7
	db #04,#de,#03,#00,#0d,#1c,#00,#84
	db #00,#05,#76,#02,#00,#0e,#1c,#00
.laa26
	db #81,#04,#06,#2c,#01,#00,#00,#00
.laa2f equ $ + 1
	db #00,#04,#00,#04,#5e,#01,#00,#0b
.laa38 equ $ + 2
	db #04,#00,#82,#00,#08,#f4,#01,#00
.laa41 equ $ + 3
	db #0f,#0a,#00,#82,#00,#07,#64,#00
.laa4a equ $ + 4
	db #00,#0f,#0a,#00,#82,#00,#09,#64
.laa53 equ $ + 5
	db #00,#00,#0f,#ff,#00,#82,#00,#00
.laa5c equ $ + 6
	db #3c,#00,#00,#0f,#05,#00,#82,#00
.laa65 equ $ + 7
	db #0a,#28,#00,#00,#0f,#0a,#00,#82
	db #00,#0b,#2c,#01,#00,#0f,#64,#00
.laa6e
	db #01,#00,#00,#00,#00,#05,#0a,#08
.laa77 equ $ + 1
	db #00,#01,#00,#0c,#2c,#01,#00,#0c
.laa80 equ $ + 2
	db #08,#00,#01,#00,#0d,#c8,#00,#00
.laa89 equ $ + 3
	db #0c,#10,#00,#82,#00,#0e,#20,#03
.laa92 equ $ + 4
	db #00,#0f,#46,#00,#84,#00,#0b,#f4
	db #01,#00,#0f,#32,#00
.laa9b
	ld a,#01
	ld hl,lab2c
	call #bcbc
	ld a,#02
	ld hl,lab30
	call #bcbc
	ld a,#03
	ld hl,lab34
	call #bcbc
	ld a,#04
	ld hl,lab38
	call #bcbc
	ld a,#01
	ld hl,lab3f
	call #bcbf
	ld a,#02
	ld hl,lab46
	call #bcbf
	ld a,#03
	ld hl,lab4d
	call #bcbf
	ld a,#04
	ld hl,lab51
	call #bcbf
	ld a,#05
	ld hl,lab55
	call #bcbf
	ld a,#06
	ld hl,lab59
	call #bcbf
	ld a,#07
	ld hl,lab60
	call #bcbf
	ld a,#08
	ld hl,lab64
	call #bcbf
	ld a,#09
	ld hl,lab68
	call #bcbf
	ld a,#0a
	ld hl,lab6f
	call #bcbf
	ld a,#0b
	ld hl,lab76
	call #bcbf
	ld a,#0c
	ld hl,lab7d
	call #bcbf
	ld a,#0d
	ld hl,lab84
	call #bcbf
	ld a,#0e
	ld hl,lab8b
	call #bcbf
	ret
.lab30 equ $ + 4
.lab2c
	db #01,#10,#ff,#02,#01,#10,#ff,#04
.lab38 equ $ + 4
.lab34
	db #01,#08,#01,#01,#02,#0e,#01,#01
.lab3f equ $ + 3
	db #0e,#ff,#05,#02,#0a,#04,#01,#1e
.lab46 equ $ + 2
	db #fd,#01,#02,#02,#02,#01,#0a,#fd
.lab51 equ $ + 5
.lab4d equ $ + 1
	db #01,#01,#32,#14,#01,#01,#12,#ec
.lab59 equ $ + 5
.lab55 equ $ + 1
	db #01,#01,#12,#14,#01,#82,#01,#9c
.lab60 equ $ + 4
	db #04,#01,#64,#04,#81,#01,#28,#01
.lab68 equ $ + 4
.lab64
	db #81,#01,#d8,#01,#82,#05,#1e,#04
.lab6f equ $ + 3
	db #19,#fb,#01,#82,#05,#04,#01,#05
.lab76 equ $ + 2
	db #fc,#01,#82,#01,#3c,#05,#01,#b0
.lab7d equ $ + 1
	db #05,#82,#01,#d8,#04,#01,#28,#04
.lab8b equ $ + 7
.lab84
	db #82,#0e,#0a,#01,#02,#ba,#01,#83
	db #14,#fb,#01,#1e,#00,#01,#14,#05
	db #01
;
.real_init_music
.lab95
;
	call laba4
	ld hl,lae00
	ld de,lae0d
	ld bc,lae1a
	jp lac1f
.laba4
	ld a,#01
	ld hl,labe4
	call #bcbc
	ld a,#02
	ld hl,labeb
	call #bcbc
	ld a,#03
	ld hl,labf2
	call #bcbc
	ld a,#04
	ld hl,labf9
	call #bcbc
	ld a,#05
	ld hl,lac03
	call #bcbc
	ld a,#06
	ld hl,lac0a
	call #bcbc
	ld a,#07
	ld hl,lac11
	call #bcbc
	ld a,#08
	ld hl,lac18
	jp #bcbc
.labeb equ $ + 7
.labe4
	db #02,#01,#0d,#01,#0d,#ff,#01,#02
.labf2 equ $ + 6
	db #01,#0d,#01,#0d,#ff,#02,#02,#01
.labf9 equ $ + 5
	db #0d,#01,#0d,#ff,#05,#03,#01,#0f
.lac03 equ $ + 7
	db #01,#06,#00,#01,#01,#f1,#01,#02
.lac0a equ $ + 6
	db #01,#09,#01,#09,#ff,#0f,#02,#01
.lac11 equ $ + 5
	db #0a,#01,#0a,#ff,#0f,#02,#01,#0b
.lac18 equ $ + 4
	db #01,#0b,#ff,#0f,#02,#01,#0c,#01
	db #0c,#ff,#0f
.lac1f
	ld (laea1),hl
	ld (laea3),de
	ld (laea5),bc
	ld ix,(laea1)
	call lac42
	ld ix,(laea3)
	call lac42
	ld ix,(laea5)
	call lac42
	jp #bca7
.lac42
	ld l,(ix+#00)
	ld h,(ix+#01)
	ld (ix+#02),l
	ld (ix+#03),h
	ld (ix+#0a),#00
	ret
;
.play_music
.lac53
;
	ld hl,(laea1)
	call lac62
	ld hl,(laea3)
	call lac62
	ld hl,(laea5)
.lac62
	ld de,lae27
	ld bc,#000d
	push hl
	ldir
	call lac78
	pop de
	ld hl,lae27
	ld bc,#000d
	ldir
	ret
.lac78
	ld a,(lae32)
	bit 0,a
	ret nz
	bit 2,a
	jp nz,lad50
	ld ix,(lae29)
	ld a,(ix+#00)
	cp #ff
	jp z,lad14
	ld b,a
	and #c0
	jr z,lacc8
	cp #40
	jr z,lacf9
	cp #80
	jp z,lad3f
.lac9d
	inc ix
	ld a,b
	and #3f
	add a
	ld c,a
	ld b,#00
	ld hl,(lae2b)
	add hl,bc
	ld c,(hl)
	inc hl
	ld b,(hl)
	ld (lae29),bc
	ld a,(lae31)
	ld c,a
	inc a
	inc a
	ld (lae31),a
	ld b,#00
	ld hl,(lae2d)
	add hl,bc
	push ix
	pop bc
	ld (hl),c
	inc hl
	ld (hl),b
	jr lac78
.lacc8
	ld a,(lae33)
	add b
	and #3f
	add a
	ld c,a
	ld b,#00
	ld e,(ix+#01)
	ld hl,lad86
	add hl,bc
	ld c,(hl)
	inc hl
	ld b,(hl)
	ld ix,(lae2f)
	ld (ix+#03),c
	ld (ix+#04),b
	ld (ix+#07),e
	ld hl,(lae2f)
	call #bcaa
	ret nc
	ld hl,(lae29)
	inc hl
	inc hl
	ld (lae29),hl
	ret
.lacf9
	ld a,b
	and #0f
	ld b,(ix+#01)
	inc ix
	inc ix
	ld (lae29),ix
	ld ix,(lae2f)
	ld (ix+#01),a
	ld (ix+#02),b
	jp lac78
.lad14
	ld a,(lae31)
	or a
	jr z,lad30
	dec a
	dec a
	ld (lae31),a
	ld c,a
	ld b,#00
	ld hl,(lae2d)
	add hl,bc
	ld c,(hl)
	inc hl
	ld b,(hl)
	ld (lae29),bc
	jp lac78
.lad30
	ld a,(lae32)
	bit 1,a
	ret nz
	ld hl,(lae27)
	ld (lae29),hl
	jp lac78
.lad3f
	ld a,(ix+#01)
	ld (lae33),a
	inc ix
	inc ix
	ld (lae29),ix
	jp lac78
.lad50
	ld ix,(lae29)
	ld a,(ix+#00)
	cp #ff
	jp z,lad14
	ld b,a
	and #c0
	jp nz,lac9d
	ld a,b
	add a
	add a
	add a
	add b
	ld c,a
	ld b,#00
	ld a,(ix+#01)
	ld ix,(lae2f)
	add ix,bc
	ld (ix+#07),a
	push ix
	pop hl
	call #bcaa
	ret nc
	ld hl,(lae29)
	inc hl
	inc hl
	ld (lae29),hl
	ret
.lad86
	dw #0777,#070c,#06a7,#0647
	dw #05ed,#0598,#0547,#04fc
	dw #04b4,#0470,#0431,#03f4
	dw #03bc,#0386,#0353,#0324
	dw #02f6,#02cc,#02a4,#027e
	dw #025a,#0238,#0218,#01fa
	dw #01d3,#01c3,#01aa,#0192
	dw #017b,#0166,#0152,#013f
	dw #012d,#011c,#010c,#00fd
	dw #00ef,#00e1,#00d5,#00c9
	dw #00be,#00b3,#00a9,#009f
	dw #0096,#008e,#0086,#007f
	dw #0077,#0071,#006a,#0064
	dw #005f,#0059,#0054,#0050
	dw #004b,#0047,#0043,#003f
	dw #0000
.lae00
	dw laea7,laea7,lae61,lae83
	dw lae34
	db #00,#00,#00
.lae0d
	dw laeb8,laeb8,lae6d,lae8d
	dw lae3d
	db #00,#04,#00
.lae1a
	dw laec1,laec1,lae75,lae97
	dw lae58
	db #00,#00,#00
.lae2d equ $ + 6
.lae2b equ $ + 4
.lae29 equ $ + 2
.lae27
	dw #0000,#0000,#0000,#0000
.lae2f
	dw #0000
.lae33 equ $ + 2
.lae32 equ $ + 1
.lae31
	db #00,#00,#00
.lae34
	db #01,#00,#00,#00,#00,#00,#00,#00
.lae3d equ $ + 1
	db #00,#02,#01,#00,#64,#00,#1f,#00
	db #00,#00,#02,#02,#00,#00,#00,#0f
	db #00,#00,#00,#02,#03,#00,#0a,#00
.lae58 equ $ + 4
	db #01,#00,#00,#00,#04,#00,#00,#00
	db #00,#00,#00,#00,#00
.lae61
	dw laedd,laef4,laf03,laf0a
.lae6d equ $ + 4
	dw laf1d,laf5f,laf68,laf7d
.lae75 equ $ + 4
	dw laf9a,lafa3,lafb4,lafd5
	dw laff6,lb02f,lb048,lb069
.lae83 equ $ + 2
	dw lb08a,#0000,#0000,#0000
.lae8d equ $ + 4
	dw #0000,#0000,#0000,#0000
.lae97 equ $ + 6
	dw #0000,#0000,#0000,#0000
	dw #0000,#0000,#0000,#0000
.laea5 equ $ + 4
.laea3 equ $ + 2
.laea1
	dw #0000,#0000,#0000
.laea7
	db #80,#00,#41,#00,#c5,#c5,#c5,#c5
	db #c5,#c5,#c5,#c5,#44,#00,#c4,#c4
.laeb8 equ $ + 1
	db #ff,#c3,#c3,#c2,#c2,#c2,#c2,#c2
.laec1 equ $ + 2
	db #c2,#ff,#80,#00,#40,#00,#3c,#30
	db #41,#00,#c6,#c6,#c6,#c6,#c6,#c6
	db #c6,#18,#0c,#18,#0c,#1a,#0c,#1b
.laedd equ $ + 6
	db #0c,#c2,#c3,#c2,#c3,#ff,#0c,#0c
	db #0c,#0c,#0c,#0c,#0c,#0c,#0c,#18
	db #0c,#0c,#0c,#18,#0c,#18,#0c,#0c
.laef4 equ $ + 5
	db #0c,#18,#0c,#18,#ff,#0c,#0c,#0c
	db #0c,#0c,#0c,#0c,#0c,#0c,#18,#0c
.laf03 equ $ + 4
	db #0c,#0c,#0c,#ff,#0c,#0c,#0c,#18
.laf0a equ $ + 3
	db #0c,#0c,#ff,#80,#03,#c1,#80,#08
	db #c2,#80,#06,#c2,#80,#03,#c1,#80
.laf1d equ $ + 6
	db #01,#c2,#80,#02,#c2,#ff,#c0,#c0
	db #c0,#c1,#80,#03,#c1,#80,#05,#c0
	db #c1,#c2,#80,#03,#c2,#80,#00,#c0
	db #c0,#c0,#c0,#c0,#c1,#80,#03,#c1
	db #80,#05,#c0,#c1,#c2,#80,#03,#c2
	db #80,#00,#c0,#c1,#c2,#80,#02,#c2
	db #c3,#c3,#c3,#80,#03,#c1,#80,#08
	db #c2,#80,#06,#c2,#80,#03,#c1,#80
	db #02,#c2,#80,#01,#c2,#80,#00,#ff
.laf5f
	db #18,#0c,#18,#0c,#1a,#0c,#1b,#3c
.laf68 equ $ + 1
	db #ff,#00,#18,#00,#0c,#00,#0c,#01
	db #0c,#00,#18,#00,#0c,#00,#18,#00
.laf7d equ $ + 6
	db #18,#01,#18,#02,#18,#ff,#00,#18
	db #00,#0c,#00,#0c,#01,#0c,#00,#18
	db #00,#0c,#00,#0c,#01,#0c,#01,#0c
	db #01,#0c,#00,#0c,#01,#0c,#01,#0c
.laf9a equ $ + 3
	db #01,#0c,#ff,#c0,#c0,#c0,#c0,#c0
.lafa3 equ $ + 4
	db #c0,#c0,#c1,#ff,#00,#30,#02,#30
	db #00,#30,#02,#30,#00,#30,#02,#30
.lafb4 equ $ + 5
	db #00,#30,#02,#30,#ff,#24,#0c,#26
	db #0c,#27,#0c,#2b,#0c,#26,#0c,#27
	db #0c,#26,#0c,#27,#0c,#24,#0c,#26
	db #0c,#27,#0c,#2b,#0c,#26,#0c,#27
.lafd5 equ $ + 6
	db #0c,#26,#0c,#27,#0c,#ff,#24,#0c
	db #2b,#0c,#27,#0c,#2b,#0c,#2e,#0c
	db #2b,#0c,#26,#0c,#2b,#0c,#24,#0c
	db #2b,#0c,#27,#0c,#2b,#0c,#2e,#0c
.laff6 equ $ + 7
	db #2b,#0c,#26,#0c,#2b,#0c,#ff,#45
	db #00,#c0,#46,#00,#c0,#47,#00,#c0
	db #48,#00,#c0,#80,#05,#48,#00,#c0
	db #47,#00,#c0,#80,#00,#46,#00,#c0
	db #45,#00,#c0,#45,#00,#c1,#46,#00
	db #c1,#47,#00,#c1,#48,#00,#c1,#80
	db #05,#48,#00,#c1,#47,#00,#c1,#80
	db #00,#46,#00,#c1,#45,#00,#c1,#ff
.lb02f
	db #45,#00,#c4,#46,#00,#c4,#47,#00
	db #c4,#48,#00,#c4,#48,#00,#c5,#47
	db #00,#c5,#46,#00,#c5,#45,#00,#c5
.lb048 equ $ + 1
	db #ff,#27,#0c,#2e,#0c,#2c,#0c,#2e
	db #0c,#33,#0c,#2e,#0c,#2c,#0c,#2e
	db #0c,#27,#0c,#2e,#0c,#2c,#0c,#2e
	db #0c,#33,#0c,#2e,#0c,#2c,#0c,#2e
.lb069 equ $ + 2
	db #0c,#ff,#27,#0c,#33,#0c,#2e,#0c
	db #33,#0c,#2c,#0c,#33,#0c,#2b,#0c
	db #33,#0c,#2c,#0c,#33,#0c,#27,#0c
	db #33,#0c,#2c,#0c,#33,#0c,#2e,#0c
.lb08a equ $ + 3
	db #33,#0c,#ff,#18,#0c,#18,#0c,#1a
	db #0c,#1b,#3c,#ff,#00,#00,#00,#00
	db #00,#00,#00,#00,#00,#00,#00,#00
	db #00,#00,#00,#ce,#1d,#90
	db #ff

	;org #a900
	;db #00,#00,#00,#00,#00,#00,#00,#00
	;db #00,#00,#00,#00,#00,#00,#00,#00
	;db #00,#00,#1f,#00,#00,#00,#00,#00
	;dw la930,#a890,#a8a9,#a8b9
	;db #00,#00,#00,#00,#00,#00,#00,#00
	;dw la930,#a8d0,#a8e9,#a8f9
;
.init_music	; added by Megachur
;
	call real_init_music
	ld hl,evt_bloc
	ld bc,#8100
	ld de,play_music
	jp #bcd7	; call play_music every CRT interrupt
evt_bloc
	db #00,#00,#00,#00,#00,#00
	db #00,#00,#00
;
.game_name
	db "5th Quadrant",0
.game_year
	db "1987",0
.game_publisher
	db "Bubble Bus Software",0
.music_author
	db "",0
.music_comment
	db "",0

	read "music_end_v1_0.asm"
